package com.liuguangzhou.controller;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.InputStream;

public class XSSFWorkbookKit {

    public static XSSFWorkbook create (InputStream inp){
        try {
            return (XSSFWorkbook) WorkbookFactory.create(inp);
        } catch (InvalidFormatException e) {
            e.printStackTrace();
        } catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    
    public static Workbook createWorkBook (InputStream inp){
        try {
            return WorkbookFactory.create(inp);
        } catch (InvalidFormatException e) {
            e.printStackTrace();
        } catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
